﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Visual_App
{
    public partial class _frm_questions : Form
    {
        public bool VISU_running { get; set; }
        public bool REDIR { get; set; }
        public string PATH { get; set; }
        public bool EINZELEP { get; set; }
        public bool RECHENL { get; set; }

        public bool Uebersicht { get; set; }
        public bool WerteG { get; set; }
        public bool FehlerG { get; set; }
        public bool WerteL { get; set; }
        public bool Aktivierungen { get; set; }
        public bool SPEC { get; set; }

        public _frm_questions()
        {
            InitializeComponent();

            this.VISU_running = false;
        }

        private void _cmd_browse_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "Datendatei|*.csv";

            if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this._tb_path.Text = sfd.FileName;
            }
        }

        private void _cb_redir_CheckedChanged(object sender, EventArgs e)
        {
            this._tb_path.Enabled = this._cb_redir.Checked;
            this._cmd_browse.Enabled = this._cb_redir.Checked;
        }

        private void _cmd_ok_Click(object sender, EventArgs e)
        {
            if(this._tb_path.Text == "" && this._cb_redir.Checked)
            {
                MessageBox.Show("Bitte Datei auswählen!");
                return;
            }

            this.REDIR = this._cb_redir.Checked;
            this.PATH = this._tb_path.Text;
            this.EINZELEP = this._cb_einzelep.Checked;
            this.RECHENL = this._cb_rechlog.Checked;
            this.Uebersicht = this._cb_uebersicht.Checked;
            this.WerteG = this._cb_WerteG.Checked;
            this.FehlerG = this._cb_FehlerG.Checked;
            this.WerteL = this._cb_WerteL.Checked;
            this.Aktivierungen = this._cb_akti.Checked;
            this.SPEC = this._cb_SPEC.Checked;

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }

        private void _cmd_cancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.Close();
        }

        private void _frm_questions_Shown(object sender, EventArgs e)
        {
            this._cb_redir.Checked = this.REDIR;
            this._tb_path.Text = this.PATH;
            this._cb_einzelep.Checked = this.EINZELEP;
            this._cb_rechlog.Checked = this.RECHENL;
            this._cb_uebersicht.Checked = this.Uebersicht;
            this._cb_WerteG.Checked = this.WerteG;
            this._cb_FehlerG.Checked = this.FehlerG;
            this._cb_WerteL.Checked = this.WerteL;
            this._cb_akti.Checked = this.Aktivierungen;
            this._cb_SPEC.Checked = this.SPEC;

            if (this.VISU_running)
            {
                this._cb_redir.Enabled = false;
                this._tb_path.Enabled = false;
                this._cmd_browse.Enabled = false;
            }
        }
    }
}
